﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_login : System.Web.UI.Page
{
    UserBus user = new UserBus();
    protected void Page_Load(object sender, EventArgs e)
    {
        
         LoadData();
        
    }
    public void LoadData()
    {
        if (Session["username"] != null || Session["username"] != null)
        {
            Response.Redirect("default.aspx");
        }
    }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        string user_name = username.Text.Trim();
        string pass = user.MaHoaMD5(password.Text.Trim());
        User us= user.getUserByUserName(user_name);
        if (us.Password.Equals(pass))
        {
            Session["username"] = user_name;
            Response.Redirect("default.aspx");
        }
    }
}